import { Module } from '@nestjs/common';
import { ConfigModule as NestConfigModule } from '@nestjs/config';

@Module({
  imports: [
    NestConfigModule.forRoot({
      isGlobal: true,
      envFilePath: ['.env', '.env.local'],
      load: [
        () => ({
          ai: {
            anthropic: {
              apiKey: process.env.ANTHROPIC_API_KEY,
              apiUrl:
                process.env.ANTHROPIC_API_URL || 'https://api.anthropic.com',
            },
            openrouter: {
              apiKey: process.env.OPENROUTER_API_KEY,
              apiUrl:
                process.env.OPENROUTER_API_URL || 'https://openrouter.ai/api',
            },
            deepseek: {
              apiKey: process.env.DEEPSEEK_API_KEY,
              apiUrl:
                process.env.DEEPSEEK_API_URL || 'https://api.deepseek.com/v1',
            },
          },
        }),
      ],
    }),
  ],
  exports: [NestConfigModule],
})
export class ConfigModule {}
